@extends('admin.base')
@section('title', '银行卡列表')
@section('content')
    <div class="layui-card">
        <fieldset class="layui-elem-field">
            <div class="layui-field-box">
            <span class="layui-breadcrumb" lay-separator=">>">
                <a class="layui-btn-sm" href="{{url('admin/type/index')}}" style="cursor:pointer;" ><cite>银行卡列表</cite></a>;
            </span>
            </div>
        </fieldset>
        <div class="layui-card-header">
            <div>
        <span class="pull-left">
          <div class="layui-form">
            <div class="layui-form-item">
              <div class="layui-inline">
                <label class="layui-form-label">关键字</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="sub_keywords" name="keywords" value="{{ isset($keywords) ? $keywords : '' }}"  placeholder="开户行">
                </div>
              </div>
            </div>
          </div>
        </span>
        <div class="layui-input-inline">
            <button class="layui-btn" lay-submit lay-filter="selectsub">搜索</button>
        </div>

            <span class="pull-right">
                <button class="layui-btn layui-btn-sm" onclick="active('{{url('admin/paytype/add')}}','','添加开户行');" >
                    <i class="layui-icon">&#xe608;</i> 添加银行卡
                </button>
            </span>
            </div>
        </div>

        <div class="layui-card-body">
            <style>
                table tr td.tc,table tr th.tc {
                    text-align: center;
                    cursor:default;
                }
            </style>
            <table class="layui-table" lay-even lay-size="">
                <colgroup>
                    <col width="">
                    <col width="">
                    <col width="">
                    <col width="">
                </colgroup>
                <thead>
                <tr>
                    <th class="tc">ID</th>
                    <th class="tc">开户银行</th>
                    <th class="tc">Logo</th>
                    <th class="tc">背景</th>
                    <th class="tc">创建时间</th>
                    <th class="tc">操作</th>
                </tr>
                <tbody>
                @if($paytype->isEmpty())
                    <tr>
                        <td colspan="6" class="tc">暂无数据</td>
                    </tr>
                @else
                    @foreach ($paytype as $v)
                        <tr>
                            <td class="tc">{{$v->id}}</td>
                            <td class="tc">{{$v->name}}</td>
                            <td class="tc"><img src="{{ $v->logo }}"></td>
                            <td class="tc"><img src="{{ $v->logo_bg }}"></td>
                            <td class="tc">{{ $v->created_at }}</td>
                        <td class="tc">
                            <div class="layui-btn-group" >
                                <button class="layui-btn layui-btn-sm" onclick="active('{{url('admin/paytype/edit')}}','{{$v->id}}','编辑');" >编辑</button>
                                <button class="layui-btn layui-btn-sm layui-btn-danger" onclick="del('{{url('admin/paytype/del')}}','{{$v->id}}');" >删除</button>
                            </div>
                        </td>
                        </tr>
                    @endforeach
                @endif
                </tbody>
                </thead>
            </table>
            <!-- 分页 -->
            <div class="sabrosus" >{{ $page }}</div>
        <!-- {{$paytype->total()}} -->
        </div>

    </div>
@endsection
@section('js')
    <script>
        layui.use('form', function(){
            var form = layui.form;

            //搜索
            form.on('submit(selectsub)', function(data){
                let keywords = $('#sub_keywords').val();//关键字
                // layer.msg(keywords+"|"+month+"|"+level)
                location.href = "{{url('admin/paytype/index')}}"+"?keywords="+keywords;
                return false;
            });

            //监听指定开关
            form.on('switch(switchTest)', function(data){
                var id = data.value;

                if(data.elem.checked){
                    var state = 1;//启用
                }else{
                    var state = 2;//禁用
                }
                ajax('/admin/user/up_state',{id:id,state:state});
            });
        });
    </script>
@endsection